package com.deltabravomedia.theoldtoad.server;

import java.io.IOException;

import javax.jdo.PersistenceManager;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;

@SuppressWarnings("serial")
public class DoesNotContainMeatServlet extends HttpServlet {

    public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
    	PersistenceManager pm = PMF.get().getPersistenceManager();
    	
    	String keyString = req.getQueryString();
    	Key itemKey = KeyFactory.stringToKey(keyString);
    	
    	Item ss = pm.getObjectById(Item.class, itemKey);    	
    	ss.setContainsMeat(false);
    	pm.makePersistent(ss);
    	
    	pm.close();
    	
		resp.sendRedirect("/update.jsp");
	}
}
